#!/bin/bash
# Mascaras
MASK_24="255.255.255.0"
MASK_25="255.255.255.128"
MASK_26="255.255.255.192"
MASK_27="255.255.255.224"
MASK_28="255.255.255.240"
MASK_29="255.255.255.248"
MASK_30="255.255.255.252"

# Puertos usados por la maquina con GNS3
# para conexion con las maquinas fisicas
GNS3_PORT_HOSTA=9000
GNS3_PORT_HOSTB=9001
GNS3_PORT_HOSTC=9002
GNS3_PORT_DNSROOT=9003
GNS3_PORT_DNS1=9004
GNS3_PORT_DNS2=9005
GNS3_PORT_WEBSERVER=9006
GNS3_PORT_FTPSERVER=9007
GNS3_PORT_TELNET_SUP=9008
GNS3_PORT_TELNET_INF=9009

# Puertos en las maquinas fisicas para conexion
# con la maquina con GNS3
HOSTA_PORT=8000
HOSTB_PORT=8001
HOSTC_PORT=8002
DNSROOT_PORT=8003
DNS1_PORT=8004
DNS2_PORT=8005
WEBSERVER_PORT=8006
FTPSERVER_PORT=8007
TELNET_SUP_PORT=8008
TELNET_INF_PORT=8009

# Direcciones IP para la configuracion de las maquinas fisicas:
# estas son las direcciones que seran asignadas a las placas
# de red de las maquinas fisicas para poder comunicarse entre
# ellas. Las unicas PCs que utilizaran estas direcciones son las
# que se setean usando una maquina fisica (host A, host B, host C, 
# webserver, telserver, ftpserver, dns root, dns1 y dns2)
IP_RED_PC_FISICAS="10.47.3.144"
MASK_RED_PC_FISICAS=$MASK_28

IP_PC_GNS3="10.47.3.145"
MASK_PC_GNS3=$MASK_28

IP_PC_HOSTA="10.47.3.146"
MASK_PC_HOSTA=$MASK_28

IP_PC_HOSTB="10.47.3.147"
MASK_PC_HOSTB=$MASK_28

IP_PC_HOSTC="10.47.3.148"
MASK_PC_HOSTC=$MASK_28

IP_PC_TELNETSERVER="10.47.3.149"
MASK_PC_TELNETSERVER=$MASK_28

IP_PC_WEBSERVER="10.47.3.150"
MASK_PC_WEBSERVER=$MASK_28

IP_PC_FTPSERVER="10.47.3.151"
MASK_PC_FTPSERVER=$MASK_28

IP_PC_DNSROOT="10.47.3.152"
MASK_PC_DNSROOT=$MASK_28

IP_PC_DNS1="10.47.3.153"
MASK_PC_DNS1=$MASK_28

IP_PC_DNS2="10.47.3.154"
MASK_PC_DNS2=$MASK_28

# Direcciones IP representadas por las maquinas fisicas:
# estas son las direcciones que tienen el host A, B, C, webserver
# telserver, ftpserver, dns root, dns1 y dns2 dentro de la topologia
# y que seran asignadas a los tuneles tap
IP_HOSTA="10.118.5.5"
MASK_HOSTA=$MASK_24

IP_HOSTB="10.19.2.163"
MASK_HOSTB=$MASK_27

IP_HOSTC="10.19.2.195"
MASK_HOSTC=$MASK_27

IP_TELNET_SUP="10.47.1.130"
MASK_TELNET_SUP=$MASK_26

IP_TELNET_INF="10.47.2.129"
MASK_TELNET_INF=$MASK_24

IP_WEBSERVER="192.168.71.71"
MASK_WEBSERVER=$MASK_24

IP_FTPSERVER="10.19.2.1"
MASK_FTPSERVER=$MASK_25

IP_DNSROOT="10.47.1.131"
MASK_DNSROOT=$MASK_26

IP_DNS1="10.118.5.31"
MASK_DNS1=$MASK_24

IP_DNS2="10.19.2.2"
MASK_DNS2=$MASK_25



# Direcciones de subredes
RED_A="10.118.5.0"
MASK_RED_A=$MASK_24

RED_B="10.19.2.128"
MASK_RED_B=$MASK_30

RED_C="192.168.71.0"
MASK_RED_C=$MASK_24

RED_D="172.143.0.64"
MASK_RED_D=$MASK_30

RED_E="10.19.2.0"
MASK_RED_E=$MASK_25

RED_F="10.47.3.32"
MASK_RED_F=$MASK_27

RED_G="10.19.2.132"
MASK_RED_G=$MASK_30

RED_H="10.19.2.192"
MASK_RED_H=$MASK_27

RED_I="10.47.1.128"
MASK_RED_I=$MASK_26

RED_J="10.47.2.0"
MASK_RED_J=$MASK_24

RED_K="10.19.2.160"
MASK_RED_K=$MASK_27

RED_L="133.143.1.4"
MASK_RED_L=$MASK_30

RED_M="133.143.1.8"
MASK_RED_M=$MASK_30

RED_N="10.47.3.64"
MASK_RED_N=$MASK_28

RED_O="10.19.2.224"
MASK_RED_O=$MASK_28

RED_P="10.19.2.136"
MASK_RED_P=$MASK_30

RED_Q="10.19.2.140"
MASK_RED_Q=$MASK_30

RED_R="10.19.2.144"
MASK_RED_R=$MASK_30

RED_S="10.19.2.148"
MASK_RED_S=$MASK_30

RED_T="133.143.1.0"
MASK_RED_T=$MASK_30

RED_U="172.143.0.72"
MASK_RED_U=$MASK_30

RED_V="172.143.0.68"
MASK_RED_V=$MASK_30

# Gateways para configurar la tabla de ruteo en cada maquina fisica
# Cada direccion se nombre en la forma:
# Por ejemplo: A_GW_C: "Para el host A el gw hacia la red C es"

# Host A (se encuentra en la red A)
# A_GW_A no existe
A_GW_B="10.118.5.2"
A_GW_C="10.118.5.30"
A_GW_D="10.118.5.1"
A_GW_E="10.118.5.1"
A_GW_F="10.118.5.1"
A_GW_G="10.118.5.1"
A_GW_H="10.118.5.1"
A_GW_I="10.118.5.1"
A_GW_J="10.118.5.1"
A_GW_K="10.118.5.2"
A_GW_L="10.118.5.2"
A_GW_M="10.118.5.1"
A_GW_N="10.118.5.2"
A_GW_O="10.118.5.1"
A_GW_P="10.118.5.1"
A_GW_Q="10.118.5.1"
A_GW_R="10.118.5.1"
A_GW_S="10.118.5.1"
A_GW_T="10.118.5.30"
A_GW_U="10.118.5.2"
A_GW_V="10.118.5.1"

# Host B (se encuentra en la red K)
B_GW_A="10.19.2.161"
B_GW_B="10.19.2.161"
B_GW_C="10.19.2.161"
B_GW_D="10.19.2.161"
B_GW_E="10.19.2.162"
B_GW_F="10.19.2.162"
B_GW_G="10.19.2.162"
B_GW_H="10.19.2.162"
B_GW_I="10.19.2.162"
B_GW_J="10.19.2.162"
# B_GW_K no existe
B_GW_L="10.19.2.162"
B_GW_M="10.19.2.162"
B_GW_N="10.19.2.162"
B_GW_O="10.19.2.162"
B_GW_P="10.19.2.162"
B_GW_Q="10.19.2.162"
B_GW_R="10.19.2.162"
B_GW_S="10.19.2.162"
B_GW_T="10.19.2.161"
B_GW_U="10.19.2.162"
B_GW_V="10.19.2.161"

# Host C (se encuentra en la red H)
C_GW_A="10.19.2.193"
C_GW_B="10.19.2.193"
C_GW_C="10.19.2.193"
C_GW_D="10.19.2.193"
C_GW_E="10.19.2.193"
C_GW_F="10.19.2.193"
C_GW_G="10.19.2.193"
# C_GW_H no existe
C_GW_I="10.19.2.194"
C_GW_J="10.19.2.194"
C_GW_K="10.19.2.193"
C_GW_L="10.19.2.193"
C_GW_M="10.19.2.194"
C_GW_N="10.19.2.193"
C_GW_O="10.19.2.194"
C_GW_P="10.19.2.194"
C_GW_Q="10.19.2.194"
C_GW_R="10.19.2.194"
C_GW_S="10.19.2.194"
C_GW_T="10.19.2.193"
C_GW_U="10.19.2.193"
C_GW_V="10.19.2.193"

# Ftp Server (se encuentra en la red E)
FTPSERVER_GW_A="10.19.2.12"
FTPSERVER_GW_B="10.19.2.10"
FTPSERVER_GW_C="10.19.2.10"
FTPSERVER_GW_D="10.19.2.12"
# FTPSERVER_GW_E no existe
FTPSERVER_GW_F="10.19.2.10"
FTPSERVER_GW_G="10.19.2.11"
FTPSERVER_GW_H="10.19.2.11"
FTPSERVER_GW_I="10.19.2.10"
FTPSERVER_GW_J="10.19.2.11"
FTPSERVER_GW_K="10.19.2.10"
FTPSERVER_GW_L="10.19.2.10"
FTPSERVER_GW_M="10.19.2.11"
FTPSERVER_GW_N="10.19.2.10"
FTPSERVER_GW_O="10.19.2.11"
FTPSERVER_GW_P="10.19.2.11"
FTPSERVER_GW_Q="10.19.2.11"
FTPSERVER_GW_R="10.19.2.11"
FTPSERVER_GW_S="10.19.2.11"
FTPSERVER_GW_T="10.19.2.10"
FTPSERVER_GW_U="10.19.2.12"
FTPSERVER_GW_V="10.19.2.11"

# Telnet Server, superior (se encuentra en la red I)
TELNETSERVER_SUP_GW_A="10.47.1.132"
TELNETSERVER_SUP_GW_B="10.47.1.132"
TELNETSERVER_SUP_GW_C="10.47.1.132"
TELNETSERVER_SUP_GW_D="10.47.1.132"
TELNETSERVER_SUP_GW_E="10.47.1.132"
TELNETSERVER_SUP_GW_F="10.47.1.132"
TELNETSERVER_SUP_GW_G="10.47.1.132"
TELNETSERVER_SUP_GW_H="10.47.1.132"
# TELNETSERVER_SUP_GW_I no existe
TELNETSERVER_SUP_GW_J="10.47.1.132"
TELNETSERVER_SUP_GW_K="10.47.1.132"
TELNETSERVER_SUP_GW_L="10.47.1.132"
TELNETSERVER_SUP_GW_M="10.47.1.132"
TELNETSERVER_SUP_GW_N="10.47.1.132"
TELNETSERVER_SUP_GW_O="10.47.1.132"
TELNETSERVER_SUP_GW_P="10.47.1.132"
TELNETSERVER_SUP_GW_Q="10.47.1.132"
TELNETSERVER_SUP_GW_R="10.47.1.132"
TELNETSERVER_SUP_GW_S="10.47.1.132"
TELNETSERVER_SUP_GW_T="10.47.1.132"
TELNETSERVER_SUP_GW_U="10.47.1.132"
TELNETSERVER_SUP_GW_V="10.47.1.132"

# Telnet Server, inferior (se encuentra en la red J)
TELNETSERVER_INF_GW_A="10.47.2.16"
TELNETSERVER_INF_GW_B="10.47.2.16"
TELNETSERVER_INF_GW_C="10.47.2.16"
TELNETSERVER_INF_GW_D="10.47.2.1"
TELNETSERVER_INF_GW_E="10.47.2.1"
TELNETSERVER_INF_GW_F="10.47.2.1"
TELNETSERVER_INF_GW_G="10.47.2.1"
TELNETSERVER_INF_GW_H="10.47.2.1"
TELNETSERVER_INF_GW_I="10.47.2.16"
# TELNETSERVER_INF_GW_J no existe
TELNETSERVER_INF_GW_K="10.47.2.16"
TELNETSERVER_INF_GW_L="10.47.2.16"
TELNETSERVER_INF_GW_M="10.47.2.16"
TELNETSERVER_INF_GW_N="10.47.2.16"
TELNETSERVER_INF_GW_O="10.47.2.15"
TELNETSERVER_INF_GW_P="10.47.2.15"
TELNETSERVER_INF_GW_Q="10.47.2.15"
TELNETSERVER_INF_GW_R="10.47.2.15"
TELNETSERVER_INF_GW_S="10.47.2.15"
TELNETSERVER_INF_GW_T="10.47.2.16"
TELNETSERVER_INF_GW_U="10.47.2.1"
TELNETSERVER_INF_GW_V="10.47.2.1"

# WebServer (se encuentra en la red C)
WEBSERVER_GW_A="192.168.71.30"
WEBSERVER_GW_B="192.168.71.30"
#WEBSERVER_GW_C no existe
WEBSERVER_GW_D="192.168.71.30"
WEBSERVER_GW_E="192.168.71.5"
WEBSERVER_GW_F="192.168.71.5"
WEBSERVER_GW_G="192.168.71.5"
WEBSERVER_GW_H="192.168.71.5"
WEBSERVER_GW_I="192.168.71.5"
WEBSERVER_GW_J="192.168.71.5"
WEBSERVER_GW_K="192.168.71.5"
WEBSERVER_GW_L="192.168.71.5"
WEBSERVER_GW_M="192.168.71.5"
WEBSERVER_GW_N="192.168.71.5"
WEBSERVER_GW_O="192.168.71.5"
WEBSERVER_GW_P="192.168.71.5"
WEBSERVER_GW_Q="192.168.71.5"
WEBSERVER_GW_R="192.168.71.5"
WEBSERVER_GW_S="192.168.71.5"
WEBSERVER_GW_T="192.168.71.5"
WEBSERVER_GW_U="192.168.71.5"
WEBSERVER_GW_V="192.168.71.5"



#DNS1 (se encuentra en la red A)
# DNS1_GW_A no existe
DNS1_GW_B="10.118.5.2"
DNS1_GW_C="10.118.5.30"
DNS1_GW_D="10.118.5.1"
DNS1_GW_E="10.118.5.1"
DNS1_GW_F="10.118.5.1"
DNS1_GW_G="10.118.5.1"
DNS1_GW_H="10.118.5.1"
DNS1_GW_I="10.118.5.1"
DNS1_GW_J="10.118.5.1"
DNS1_GW_K="10.118.5.2"
DNS1_GW_L="10.118.5.2"
DNS1_GW_M="10.118.5.1"
DNS1_GW_N="10.118.5.2"
DNS1_GW_O="10.118.5.1"
DNS1_GW_P="10.118.5.1"
DNS1_GW_Q="10.118.5.1"
DNS1_GW_R="10.118.5.1"
DNS1_GW_S="10.118.5.1"
DNS1_GW_T="10.118.5.30"
DNS1_GW_U="10.118.5.2"
DNS1_GW_V="10.118.5.1"

#DNS2 (se encuentra en la red E)
DNS2_GW_A="10.19.2.12"
DNS2_GW_B="10.19.2.10"
DNS2_GW_C="10.19.2.10"
DNS2_GW_D="10.19.2.12"
# DNS2_GW_E no existe
DNS2_GW_F="10.19.2.10"
DNS2_GW_G="10.19.2.11"
DNS2_GW_H="10.19.2.11"
DNS2_GW_I="10.19.2.10"
DNS2_GW_J="10.19.2.11"
DNS2_GW_K="10.19.2.10"
DNS2_GW_L="10.19.2.10"
DNS2_GW_M="10.19.2.11"
DNS2_GW_N="10.19.2.10"
DNS2_GW_O="10.19.2.11"
DNS2_GW_P="10.19.2.11"
DNS2_GW_Q="10.19.2.11"
DNS2_GW_R="10.19.2.11"
DNS2_GW_S="10.19.2.11"
DNS2_GW_T="10.19.2.10"
DNS2_GW_U="10.19.2.12"
DNS2_GW_V="10.19.2.11"

#DNSROOT (se encuentra en la red I)
DNSROOT_GW_A="10.47.1.132"
DNSROOT_GW_B="10.47.1.132"
DNSROOT_GW_C="10.47.1.132"
DNSROOT_GW_D="10.47.1.132"
DNSROOT_GW_E="10.47.1.132"
DNSROOT_GW_F="10.47.1.132"
DNSROOT_GW_G="10.47.1.132"
DNSROOT_GW_H="10.47.1.132"
# DNSROOT_GW_I no existe
DNSROOT_GW_J="10.47.1.132"
DNSROOT_GW_K="10.47.1.132"
DNSROOT_GW_L="10.47.1.132"
DNSROOT_GW_M="10.47.1.132"
DNSROOT_GW_N="10.47.1.132"
DNSROOT_GW_O="10.47.1.132"
DNSROOT_GW_P="10.47.1.132"
DNSROOT_GW_Q="10.47.1.132"
DNSROOT_GW_R="10.47.1.132"
DNSROOT_GW_S="10.47.1.132"
DNSROOT_GW_T="10.47.1.132"
DNSROOT_GW_U="10.47.1.132"
DNSROOT_GW_V="10.47.1.132"


# Direcciones de servidores de DNS para: host A, host B, host C, ftpserver
# telnetserver, webserver, dns root, dns1 y dns2
SERVIDOR_DNS_PARA_HOSTA=$IP_DNS1
SERVIDOR_DNS_PARA_HOSTB=$IP_DNS2
SERVIDOR_DNS_PARA_HOSTC=$IP_DNS2
SERVIDOR_DNS_PARA_FTPSERVER=$IP_DNS2
SERVIDOR_DNS_PARA_TELNETSERVER=$IP_DNS2
SERVIDOR_DNS_PARA_WEBSERVER=$IP_DNS1
SERVIDOR_DNS_PARA_DNSROOT="127.0.0.1"
SERVIDOR_DNS_PARA_DNS1=$IP_DNSROOT
SERVIDOR_DNS_PARA_DNS2=$IP_DNSROOT


